home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / tests / RCS / SubClass3.m,v < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.2 KB  |  103 lines

  1. head    1.1;
  2. access;
  3. symbols;
  4. locks
  5.     dglattin:1.1; strict;
  6. comment    @# @;
  7.  
  8.  
  9. 1.1
  10. date    92.08.18.04.58.04;    author dglattin;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @test code.
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @#include  <assert.h>
  26. #include  <limits.h>
  27. #include  <stdlib.h>
  28. #include  <strings.h>
  29. #include  <SubClass3.h>
  30.  
  31.  
  32. @@implementation SubClass3
  33.  
  34. #define THE_MESSAGE "This is a test message from"
  35.  
  36.  
  37. + initialize {
  38.  
  39.   printf( "If you see this message then SubClass3 received a"
  40.     " +initialize method\n" );
  41.   
  42.   return self;
  43. }
  44.  
  45.  
  46. + new {
  47.  
  48.   self = [ super new ];
  49.   sprintf (smart, THE_MESSAGE);
  50.  
  51.   return self;
  52. }
  53.  
  54.  
  55. - print:( const char* )aPhrase {
  56.  
  57.   char  aMsg[ 2048 ];
  58.   
  59.   
  60.   sprintf( aMsg, "This message comes to you from SubClass3 forwarded"
  61.     " to it's super class, msg=%s\n", aPhrase );
  62.   
  63.   return [ super print:aMsg ] ;
  64. }
  65.  
  66.  
  67. - ( int )additionalMethod {
  68.  
  69.  
  70.   return INT_MAX;
  71. }
  72.  
  73.  
  74. - storeOn:( int )aFd {
  75.  
  76.   int len;
  77.   
  78.   
  79.   [ super storeOn:aFd ];
  80.   len = write (aFd, smart, sizeof (smart));
  81.   assert(len == sizeof (smart));
  82.   
  83.   return self;
  84. }
  85.  
  86.  
  87. - readFrom:( int )aFd {
  88.  
  89.   int len;
  90.   
  91.   
  92.   [ super readFrom:aFd ];
  93.   len = read (aFd, smart, sizeof (smart));
  94.   assert(len == sizeof (smart));
  95.   assert(!strcmp (smart, THE_MESSAGE));
  96.   
  97.   return self;
  98. }
  99.  
  100.  
  101.  
  102. @@end@
  103.